Learn R Programming

admisc (version 0.1)

Number equality: Check difference and / or equality of numbers

Description

Check if one number is greater/lower than or equal to another.

Usage

agteb(a, b)
alteb(a, b)
aeqb(a, b)

Arguments

a

Numerical vector of numbers

b

Numerical vector of numbers

Details

Not all numbers (especially the decimal ones) can be represented exactly in floating point arithmetic, and their arithmetic may not give the normal expected result.

Function agteb() checks if a number a is “greater than or equal to” (gte) another number b. In the same spirit, function alteb() checks if a number a is “lower than or equal to” (lte) another number b, while function aeqb() checks for their equality (eq).

References

Goldberg, David (1991) "What Every Computer Scientist Should Know About Floating-point Arithmetic", ACM Computing Surveys vol.23, no.1, pp.5-48, DOI: 10.1145/103162.103163